package com.lifp.controller;

import com.lifp.annotation.SysLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author lfp
 * @Date 2022/8/25
 * @Version 1.0
 */
@RestController
@RequestMapping("syslog")
@Slf4j
public class SysLogAnnoTestController {

    //不加注解
    @GetMapping("method")
    public void method(){
        log.info("======> 执行了无参方法 method()");
    }

    //无参方法，加注解
    @GetMapping("method1")
    @SysLog
    public void method1(){
        log.info("======> 执行了无参方法 method1()");
    }

    //有参方法，加注解
    @GetMapping("method2")
    @SysLog
    public void method2(@RequestParam("name") String name){
        log.info("======> 执行了方法:{},方法参数为：{}","method2()",name);
    }
}
